package com.ym.b2b.charge.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.ym.b2b.charge.dao.SaleSummaryDao;
import com.ym.b2b.charge.vo.SaleSummaryVO;
import com.ym.b2b.commons.dao.BaseDao;
import com.zc.commons.base.Page;

/**
 * @ClassName: SaleSummaryDaoImpl
 * @Description: TODO
 * @Author tangxj
 * @Date 2015-3-10 下午3:13:36
 * @Modify
 * @CopyRight B2B小组
 */
@Service
public class SaleSummaryDaoImpl<T> extends BaseDao<T> implements SaleSummaryDao {

    @Override
    public Page<SaleSummaryVO> searchPageSaleSummary(SaleSummaryVO saleSummaryVO, Page<SaleSummaryVO> page) {
        page.setTotalRow(searchSaleSummaryNum(saleSummaryVO));
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("map", saleSummaryVO);

        map.put("startrow", page.getStartRow());
        map.put("pagesize", page.getPageSize());
        map.put("pageable", page.getPageable());
        page.setRows(list("SaleSummary.searchPageSaleSummary", map));
        return page;
    }

    @Override
    public Long searchSaleSummaryNum(SaleSummaryVO saleSummaryVO) throws DataAccessException {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("map", saleSummaryVO);
        return (Long) find("SaleSummary.searchSaleSummaryNum", map);
    }

}
